Kinetis SDK API Reference Manual  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
FlexTimer Peripheral Driver

The section describes the programming interface of the FlexTimer Peripheral driver. More...

Data Structures

struct  ftm_channel_info_t
 Channel information. More...
 
struct  ftm_combined_channel_info_t
 Combines channel information. More...
 
struct  ftm_user_config_t
 Internal driver state information grouped by naming. More...
 
struct  ftm_pwm_param_t
 FlexTimer driver PWM parameter. More...
 

Functions

void ftm_init (uint8_t instance, ftm_user_config_t *info)
 Initializes the FTM driver. More...
 
void ftm_shutdown (ftm_user_config_t *state)
 Shuts down the FTM driver. More...
 
void ftm_pwm_start (ftm_user_config_t *info, uint8_t channel)
 Starts channel PWM. More...
 
void ftm_pwm_stop (ftm_user_config_t *info, uint8_t channel)
 Stops channel PWM. More...
 
void ftm_pwm_configure (ftm_user_config_t *info, uint8_t channel, ftm_pwm_param_t *param)
 Configures duty cycle and frequency of the channel PWM. More...
 

Data Structure Documentation

struct ftm_channel_info_t

Data Fields

ftm_config_mode_t mode
 FlexTimer operation mode.
 
ftm_edge_mode_t edge_mode
 capture mode
 
bool isChannelEnabled
 
bool isSoftwareOutputCTRL
 
bool isSoftwareOutput
 1:output high 0:output low
 
bool isChannlePinEnabled
 
bool isChannelInterrupt
 
bool isChannelDMA
 
uint8_t inputCaptureFilterVal
 
struct ftm_combined_channel_info_t

Data Fields

bool isComplementaryMode
 
bool isFaultCTRLEnabled
 
bool isSyncEnabled
 
bool isDeadTimeEnabled
 
bool isInvertingEnabled
 
struct ftm_user_config_t

User needs to set the relevant ones.

Data Fields

uint8_t instance
 name FTM instance FTM0, FTM1, FTM2, FTM3
 
ftm_clock_source_t clockSrc
 
ftm_clock_ps_t clockPS
 
uint16_t counterInitVal
 
uint16_t counterMod
 
uint32_t frequencyHZ
 
ftm_deadtime_ps_t deadtimePrescaler
 
uint8_t uDeadTimeCount
 
uint8_t uNumOfOverflows
 
bool isFTMMode
 
uint8_t BDMMode
 
bool isGlobalTimeBase
 
bool isGlobalTimeOutput
 
bool isWriteProtection
 
ftm_combined_channel_info_t combinedChanSetting [HW_FTM_CHANNEL_PAIR_COUNT]
 
bool isEnhancedSyncMode
 
bool isHWTriggerMode
 
bool isCNTINSync
 
bool isINVCTRLSync
 
bool isSWOCCTRLsync
 
bool isSWTriggermode
 
bool isOutmaskSync
 
bool isMinLoadingPoint
 
bool isMaxLoadingPoint
 
bool isExternalCINTTrigger
 
bool isExternalChan0Trigger
 
bool isExternalChan1Trigger
 
bool isExternalChan2Trigger
 
bool isExternalChan3Trigger
 
bool isExternalChan4Trigger
 
bool isExternalChan5Trigger
 
bool isFaultCTRLMode
 
bool isFaultInputFilter
 
bool isFaultInput0Filter
 
bool isFaultInput0Polarity
 
bool isFaultInput1Filter
 
bool isFaultInput1Polarity
 
bool isFaultInput2Filter
 
bool isFaultInput2Polarity
 
bool isFaultInput3Filter
 
bool isFaultInput3Polarity
 
ftm_channel_info_t channleInfo [HW_FTM_CHANNEL_COUNT]
 
bool enableFaultPin0
 
bool enableFaultPin1
 
bool enableFaultPin2
 
bool enableFaultPin3
 
uint8_t externalClockPin
 
bool isHardwareTrigger0
 
bool isHardwareTrigger1
 
bool isHardwareTrigger2
 
uint8_t interruptPriority
 
uint8_t interruptInstance
 
bool isInterruptRequest
 
bool isTimerOverFlowInterrupt
 
bool isFaultInterrupt
 
bool isInitChannelOutput
 
bool isLoadEnable
 
bool isChannel0LoadSel
 
bool isChannel1LoadSel
 
bool isChannel2LoadSel
 
bool isChannel3LoadSel
 
bool isChannel4LoadSel
 
bool isChannel5LoadSel
 
bool isChannel6LoadSel
 
bool isChannel7LoadSel
 
struct ftm_pwm_param_t

Setting uPulseHigPercentage = 1, uPulseLowPulsePercentage = 1 means sin wave equal to low and high width.

Data Fields

uint32_t uFrequencyHZ
 PWM period.
 
uint32_t uPulseHighPercentage
 High pulse width period.
 
uint32_t uPulseLowPercentage
 Low pulse width period.
 
uint16_t uCnV
 In combined mode, the n channel count value, the duty cycle=|Cn+1V -CnV|.
 

Function Documentation

void ftm_init ( uint8_t  instance,
ftm_user_config_t info 
)
Parameters
instanceThe FTM peripheral instance number.
infoThe FTM user config structure.
void ftm_shutdown ( ftm_user_config_t state)
Parameters
stateThe FTM user config structure.
void ftm_pwm_start ( ftm_user_config_t info,
uint8_t  channel 
)
Parameters
infoThe FTM user config structure.
channelThe channel or channel pair number(combined mode).
void ftm_pwm_stop ( ftm_user_config_t info,
uint8_t  channel 
)
Parameters
infoThe FTM user config structure.
channelThe channel or channel pair number(combined mode).
void ftm_pwm_configure ( ftm_user_config_t info,
uint8_t  channel,
ftm_pwm_param_t param 
)
Parameters
infoThe FTM user config structure.
channelThe channel or channel pair number(combined mode). For channel pair, channel= 0(0,1),1(2,3),2(4,5),3(6,7)
paramFTM driver PWM parameter to configure PWM options